import request from '@/utils/request'
const path = 'http://39.108.248.115:9000'
const userApi = {
  digit: path + '/base/captcha/digit', // 数字验证码
  Login: path + '/base/login/signIn', // 登录
  Logout: path + '/base/login/signOut', // 退出
  changepwd: path + '/base/account/changepwd', // 修改密码
  refreshToken: path + '/base/login/refreshToken', // 刷新token
  tree: path + '/base/roles/permission/tree'// 登录的权限树
}

// 修改登录账号密码
export function changePwd (parameter) {
  return request({
    url: userApi.changepwd,
    method: 'put',
    data: parameter
  })
}

// 数字验证码
export function getDigit (parameter) {
  return request({
    url: userApi.digit + '?uuid=' + parameter.uuid,
    method: 'get',
    responseType: 'blob' // 选择接收方式为blob
  })
}
// 刷新token
export function refreshToken (parameter) {
  return request({
    url: userApi.refreshToken,
    method: 'post',
    data: parameter
  })
}
// 登录
export function login (parameter) {
  return request({
    url: userApi.Login,
    method: 'post',
    data: parameter
  })
}

export function getTree () {
  return request({
    url: userApi.tree,
    method: 'get'
  })
}
// 退出
export function logout () {
  return request({
    url: userApi.Logout,
    method: 'post'
  })
}
